/**
 *  @file HttpRequest.h
 */
#ifndef _HTTPREQUEST_H_
#define _HTTPREQUEST_H_

#include "HttpMessage.h"
#include "HttpConst.h"
#include "../../text/CFString.h"
#include "../../collections/KeyValueListT.h"

namespace cppflib
{

namespace net
{

namespace http
{

/**
 *  A class which contains information about a HTTP request
 */
class _DLLAPI HttpRequest : public HttpMessage
{
private:
    httpmethod_t method;
    CFString fullUrl;
    int portNum;

private:
    HttpRequest(void);

public:
    explicit HttpRequest(httpmethod_t method);
    virtual ~HttpRequest(void);

    void SetUrl(pcwstr_t plainUrl);
    void SetUrl(pcwstr_t urlPath, const collections::NameValueList &keyValueParameters);
    
    httpmethod_t GetMethod();
    void GetURL(CFString &url);
    void GetURLForProxy(CFString &url);
    void GetHost(CFString &host);
    void GetReqPath(CFString &path, bool includeUrlParams = false);
    int GetPort();
    bool IsSSLRequired();
    bool IsSameHostAndPort(HttpRequest &req);

    bool HasUrlParams(void);
    bool GetUrlParams(collections::NameValueList &keyValueParameters);
};

} // end of namespace http

} // end of namespace net

} // end of namespace cppflib


#endif
